import config from '@/config'
import store from '@/store'

module.exports.switchTab = (tabName) => {
	// console.log(getApp().$u) // getApp可以获取到Vue实例
	var pages = getCurrentPages()
	var currentPage = pages[pages.length - 1]
	if (currentPage.route === config.tabPath) {
		store.dispatch('switchTab', tabName)
	} else {
		uni.reLaunch({
			url: `/${config.tabPath}?tab=${tabName}`
		})
	}
}
